package com.fieldchain.ex.fa100.access;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.WindowManager;

import com.fieldchain.ex.fa100.R;
import com.fieldchain.ex.fa100.utils.common.DataCleanManager;

/**
 * Created by biyunlong
 * Email: 1225198434@qq.com
 * Data:  2018/11/2
 */
public class WelcomeActivity extends AppCompatActivity {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        setValue();
    }

    public void setValue() {
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);//隐藏状态栏
        DataCleanManager.clearAllCache(MyApplication.getAppContext());
        Thread myThread=new Thread(){//创建子线程
            @Override
            public void run() {
                try{
                    sleep(2500);//使程序休眠五秒
                    Intent it=new Intent(getApplicationContext(),MainActivity.class);//启动MainActivity
                    startActivity(it);
                    finish();//关闭当前活动
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        };
        myThread.start();//启动线程
    }

    public int getLayout() {
        return R.layout.activity_welcome;
    }
}
